<template>
	<view class="weather-container">
		<view class="current-weather">
			<view class="header">
				<view class="city">{{ city }}</view>
				<view class="date">{{ currentDate }}</view>
			</view>
			<view class="weather-main">
				<view class="temperature">{{ temperature }}°</view>
				<view class="weather-icon">☀️</view>
			</view>
			<view class="weather-description">{{ weatherDescription }}</view>
			<view class="details">
				<view class="detail-item">
					<view class="detail-icon">💧</view>
					<view class="detail-text">湿度: {{ humidity }}%</view>
				</view>
				<view class="detail-item">
					<view class="detail-icon">🌬️</view>
					<view class="detail-text">风速: {{ windSpeed }} km/h</view>
				</view>
			</view>
		</view>
		<view class="forecast">
			<view class="forecast-title">7天天气预报</view>
			<view v-for="(day, index) in forecast" :key="index" class="forecast-item">
				<text class="forecast-date">{{ day.date }}</text>
				<view class="forecast-icon">{{ day.icon }}</view>
				<text class="forecast-temp">{{ day.tempRange }}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				city: '宿迁',
				currentDate: '2023年5月1日',
				temperature: 28,
				weatherDescription: '晴朗',
				humidity: 58,
				windSpeed: 15,
				forecast: [{
						date: '今天',
						icon: '☀️',
						tempRange: '20~28°'
					},
					{
						date: '明天',
						icon: '🌤️',
						tempRange: '19~28°'
					},
					{
						date: '后天',
						icon: '⛅',
						tempRange: '18~28°'
					},
					{
						date: '周四',
						icon: '🌥️',
						tempRange: '17~27°'
					},
					{
						date: '周五',
						icon: '🌦️',
						tempRange: '16~26°'
					},
					{
						date: '周六',
						icon: '🌤️',
						tempRange: '18~27°'
					},
					{
						date: '周日',
						icon: '☀️',
						tempRange: '19~29°'
					},
				]
			}
		}
	}
</script>

<style scoped>
	.weather-container {
		font-family: 'Helvetica Neue', Arial, sans-serif;
		background-color: #f0f8ff;
		padding: 20px;
		border-radius: 20px;
		box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
	}

	.current-weather {
		background: linear-gradient(135deg, #6ab7ff, #4facfe);
		color: white;
		padding: 25px;
		border-radius: 15px;
		margin-bottom: 20px;
		box-shadow: 0 5px 15px rgba(79, 172, 254, 0.4);
	}

	.header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20px;
	}

	.city {
		font-size: 28px;
		font-weight: bold;
	}

	.date {
		font-size: 14px;
		opacity: 0.8;
	}

	.weather-main {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20px;
	}

	.temperature {
		font-size: 64px;
		font-weight: bold;
	}

	.weather-icon {
		font-size: 64px;
	}

	.weather-description {
		font-size: 20px;
		margin-bottom: 20px;
	}

	.details {
		display: flex;
		justify-content: space-between;
	}

	.detail-item {
		display: flex;
		align-items: center;
	}

	.detail-icon {
		font-size: 20px;
		margin-right: 8px;
	}

	.detail-text {
		font-size: 16px;
	}

	.forecast {
		background-color: white;
		border-radius: 15px;
		padding: 20px;
		box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
	}

	.forecast-title {
		font-size: 20px;
		font-weight: bold;
		margin-bottom: 15px;
		color: #333;
	}

	.forecast-item {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 12px 0;
		border-bottom: 1px solid #eee;
	}

	.forecast-item:last-child {
		border-bottom: none;
	}

	.forecast-date {
		font-size: 16px;
		color: #333;
	}

	.forecast-icon {
		font-size: 24px;
	}

	.forecast-temp {
		font-size: 16px;
		color: #666;
	}
</style>